import 'package:flutter/material.dart';
import 'package:yysk_app/utils/colors.dart';

/// 圆形返回按钮，可以扩展为其他圆形功能性按钮
/// * [onPressed] 点击事件
/// * [icon] 图标
/// * [left] 左边距
/// * [right] 右边距
/// * [size] 按钮大小
class CircleArrowBackWidget extends StatelessWidget {
  final VoidCallback? onPressed;
  final IconData? icon;
  final double? left;
  final double? marginLeft;
  final double? right;
  final double? size;
  final Color? backgroundColor;
  const CircleArrowBackWidget({
    super.key,
    this.onPressed,
    this.icon = Icons.arrow_back_ios,
    this.left = 8,
    this.right = 0,
    this.size = 40,
    this.marginLeft = 0,
    this.backgroundColor = AppColors.backgroundColor,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onPressed,
      child: Container(
        margin: EdgeInsets.only(left: marginLeft!),
        height: size,
        width: size,
        // decoration: BoxDecoration(
        //   borderRadius: BorderRadius.circular(size!),
        //   color: AppColors.backgroundColor,
        // ),
        child: Container(
          alignment: Alignment.center,
          margin: EdgeInsets.fromLTRB(left!, 0, right!, 0),
          child: Icon(icon, color: backgroundColor, size: 18),
        ),
      ),
    );
  }
}
